package com.example.controller;

import com.example.model.Person;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableView;
import java.time.LocalDate;

public class PersonController {
    @FXML
    private TableView<Person> personTable;

    private final ObservableList<Person> personData = 
        FXCollections.observableArrayList();

    @FXML
    private void initialize() {
        // 初始化示例数据
        personData.addAll(
            new Person(1, "张三", "zhangsan@example.com", LocalDate.of(1990, 5, 15)),
            new Person(2, "李四", "lisi@example.com", LocalDate.of(1985, 8, 23)),
            new Person(3, "王五", "wangwu@example.com", LocalDate.of(2000, 3, 7))
        );
        
        // 绑定数据到表格
        personTable.setItems(personData);
    }
}